package com.example.villagemanager.ui.adapter;

import android.annotation.SuppressLint;
import android.bluetooth.BluetoothDevice;
import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.villagemanager.R;
import com.example.villagemanager.model.bean.ListViewAdapterBean;
import com.example.villagemanager.model.bean.Person;
import com.example.villagemanager.ui.base.BaseAdapter;

import java.util.List;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.ButterKnife;

public class BlueToothDeviceAdapter extends BaseAdapter<BluetoothDevice, BlueToothDeviceAdapter.ViewHolder>  {
    public BlueToothDeviceAdapter(Context mContext, List<BluetoothDevice> mList) {
        super(mContext, mList);
    }

    @Override
    protected ViewHolder getViewHolder(View itemView) {
        return new ViewHolder(itemView);
    }

    @Override
    protected int getItemView() {
        return R.layout.bluetooth_item;
    }

    @SuppressLint("MissingPermission")
    @Override
    protected void onBindHolder(ViewHolder holder, int position) {
        BluetoothDevice device = mList.get(position);
        holder.tvName.setText(device.getName());
        holder.tvSex.setText(""+device.getBondState());
        holder.tvAge.setText(""+device.getType());
    }


    static class ViewHolder extends RecyclerView.ViewHolder {
        @BindView(R.id.item_name)
        TextView tvName;
        @BindView(R.id.item_sex)
        TextView tvSex;
        @BindView(R.id.item_age)
        TextView tvAge;
        @BindView(R.id.item_address)
        TextView tvAddr;
        @BindView(R.id.item_nation)
        TextView tvNation;
        @BindView(R.id.item_icon)
        ImageView ivIcon;

        public ViewHolder(@NonNull View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }
    }
}
